import 'package:yurun_smartmerchants/models/business_entity.dart';

businessResponseFromJson(BusinessResponse data, Map<String, dynamic> json) {
	if (json['type'] != null) {
		data.type = new List<BusinessResponseType>();
		(json['type'] as List).forEach((v) {
			data.type.add(new BusinessResponseType().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> businessResponseToJson(BusinessResponse entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.type != null) {
		data['type'] =  entity.type.map((v) => v.toJson()).toList();
	}
	return data;
}

businessResponseTypeFromJson(BusinessResponseType data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code']?.toInt();
	}
	if (json['children'] != null) {
		data.children = new List<BusinessResponseTypechild>();
		(json['children'] as List).forEach((v) {
			data.children.add(new BusinessResponseTypechild().fromJson(v));
		});
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	return data;
}

Map<String, dynamic> businessResponseTypeToJson(BusinessResponseType entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	if (entity.children != null) {
		data['children'] =  entity.children.map((v) => v.toJson()).toList();
	}
	data['name'] = entity.name;
	return data;
}

businessResponseTypechildFromJson(BusinessResponseTypechild data, Map<String, dynamic> json) {
	if (json['modifiedTime'] != null) {
		data.modifiedTime = json['modifiedTime']?.toString();
	}
	if (json['modular'] != null) {
		data.modular = json['modular']?.toInt();
	}
	if (json['deleted'] != null) {
		data.deleted = json['deleted'];
	}
	if (json['creatorId'] != null) {
		data.creatorId = json['creatorId']?.toInt();
	}
	if (json['modifierId'] != null) {
		data.modifierId = json['modifierId']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['createdTime'] != null) {
		data.createdTime = json['createdTime']?.toString();
	}
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['marketId'] != null) {
		data.marketId = json['marketId']?.toInt();
	}
	return data;
}

Map<String, dynamic> businessResponseTypechildToJson(BusinessResponseTypechild entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['modifiedTime'] = entity.modifiedTime;
	data['modular'] = entity.modular;
	data['deleted'] = entity.deleted;
	data['creatorId'] = entity.creatorId;
	data['modifierId'] = entity.modifierId;
	data['name'] = entity.name;
	data['createdTime'] = entity.createdTime;
	data['id'] = entity.id;
	data['marketId'] = entity.marketId;
	return data;
}